package cn.kgc.ffzw.myeat.services.impl;

import cn.kgc.ffzw.myeat.commons.Collection;
import cn.kgc.ffzw.myeat.module.Orders;
import cn.kgc.ffzw.myeat.services.BossService;

/**
 * 店家类
 * @author
 * @Des
 * @date 2019/11/25
 */
public class BossImpl extends AbstractUser implements BossService {

    private Collection orders;

    public BossImpl(){}

    public BossImpl(Collection ord){
        this.orders=ord;
    }

    public BossImpl(int userId, String realName, String account, String password
            , int age, int sex, String telephone, String address, String power) {
        super(userId, realName, account, password, age, sex, telephone, address, power);
    }



    @Override
    public Collection findOrder() {
        Collection col=new Collection();
        for (int i = 0; i < orders.size(); i++) {
            Orders ord=(Orders)orders.get(i);
            if(ord.getStatus()==1){
                col.add(orders.get(i));
            }
        }
        return col;
    }

    /**
     *修改订单状态为2   发货
     * @param ordId
     * @return
     */
    @Override
    public boolean modifyOrder(int ordId) {
        for (int i = 0; i < orders.size(); i++) {
            Orders ord=(Orders)orders.get(i);
            if (ord.getOrdId()==ordId){
                ord.setStatus(2);
            }
        }
        return false;
    }
}
